package cn.rengy.web.framework.sys.user.web;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.rengy.lang.ResultEntity;
import cn.rengy.web.framework.sys.user.service.UserService;


/**
 * 
 * 
 */
@Controller
@RequestMapping(value = "/authenticated/user")
public class UserController {
	private static Logger logger = LoggerFactory.getLogger(UserController.class);
	@Autowired
	private UserService userService;
	
//	@RequestMapping(value="/getUserInfo")
//	@ResponseBody
//    public ResultEntity<?> getUserInfo(){
//		Map<String,Object> userInfo=userService.getUserInfo();
//		return ResultEntity.ok(userInfo);
//    }
	
	/**
	 * 绑定登录账号
	 * @return
	 */
	@RequestMapping(value="/bindLogin")
	@ResponseBody
    public ResultEntity<?> bindLogin(@RequestBody Map<String,Object> paramMap){
		userService.bindLogin(paramMap);
		return ResultEntity.ok();
    }
	
	/**
	 * 重置密码
	 * @param paramMap
	 * @return
	 * @throws Exception 
	 */
	@RequestMapping(value="password",method = RequestMethod.POST)
	@ResponseBody
	public ResultEntity<?> resetpwd (@RequestBody Map<String,Object> paramMap) throws Exception{
		userService.resetpwd(paramMap);
		return ResultEntity.ok();
	}
}
